<!DOCTYPE html>
<!-- Created by 白墨 on 2021/4/17 22:32:51-->
<html lang="zh-cmn-Hans-CN"  xmlns:th="http://www.thymeleaf.org">

<head th:replace="admin/_fragments::head(~{::title})">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>新增分类</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
  <link rel="stylesheet" href="../../static/css/me.css">
</head>

<body>
<!-- 导航 -->
<nav th:replace="admin/_fragments::menu(2)" class="ui inverted attached segment">

</nav>
<div class="ui attached pointing menu tm-hf">
  <div class="ui container">
    <div class="right menu" style="margin-right: 150px;">
      <a href="#" th:href="@{/admin/types/input}" class="blue active item">发布</a>
      <a href="#" th:href="@{/admin/types}"  class="item">列表</a>
    </div>
  </div>
</div>
<!--中间内容-->
<div  class="m-container-small m-padded-tb-big">
  <div class="ui container form" th:classappend="${result!=null?(result?'success':'error'):''}">
    <form action="#" method="post" th:object="${type}" th:action="*{id}==0 ? @{/admin/types}:@{/admin/types/{id}(id=*{id})}"  class="ui form">
      <input type="hidden" name="id" th:value="*{id}">
      <div class=" field">
        <div class="ui left labeled input">
          <label class="ui blue basic label">名称</label>
          <input type="text" name="name" placeholder="分类名称" th:object="${type}" th:value="*{name}"/>
        </div>
      </div>
      <div class="ui message" th:classappend="${result!=null?(result?'success':'error'):'success'}">
        <i class="close icon"></i>
        <div class="header">提示：</div>
        <p th:text="${message}">恭喜，添加成功！</p>
      </div>
      <div class="ui right aligned container">
        <button type="button" class="ui button" onclick="window.history.go(-1)" >返回</button>
        <button class="ui green submit button">提交</button>
      </div>

    </form>
  </div>
</div>

<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>


<!-- 底部 -->
<footer th:replace="admin/_fragments::footer" class="ui inverted vertical segment m-padded-tb-massive">

</footer>

<script src="https://lib.baomitu.com/jquery/3.5.1/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>


<script>
  $('.ui.form').form({
    fields : {
      title : {
        identifier: 'name',
        rules: [{
          type : 'empty',
          prompt: '请输入分类名称'
        }]
      }
    }
  });
  $('#newblog-container').load("[[@{/footer/newblog}]]");
</script>
</body>

</html>